package com.googlecode.data.materials
{
	import com.googlecode.data.IValueObject;
	import com.googlecode.data.ValueObject;
	
	public class BaseMaterial extends ValueObject
	{
		
		public var face:String;
		
		public var invisible:Boolean = false;
		
		public var lineAlpha:Number = 0;
		
		public var lineColor:uint = 0;
		
		public var lineThickness:Number = 1;
		
		//public var name:String;
		
		public var oneSide:Boolean = true;
		
		public var opposite:Boolean = false;
		
		public var smooth:Boolean = true;
		
		public var tiled:Boolean = false;
		
		public var doubleSided:Boolean = false;
		
		override public function clone(src:* = null):IValueObject
		{	
			if(src == null)
			{
				throw(new Error("BaseMaterial cannot be cloned. Use one of its subclasses."));
			}

			//src.animated = this.animated;
			src.doubleSided = this.doubleSided;
			src.face = this.face;
			//src.fillAlpha = this.fillAlpha;
			//src.fillColor = this.fillColor;
			src.invisible = this.invisible;
			src.lineAlpha = this.lineAlpha;
			src.lineColor = this.lineColor;
			src.lineThickness = this.lineThickness;
			//src.name = this.name;
			src.oneSide = this.oneSide;
			src.opposite = this.opposite;
			src.smooth = this.smooth;
			src.tiled = this.tiled;
			

			return src;					
		}
		
		override public function toXML(src:XML = null):XML
		{
			if(src == null)
			{
				src = new XML(<material></material>);
			}
			
			src.@face = this.face;		
			//src.appendChild(<fillAlpha>{this.fillAlpha}</fillAlpha>);
			//src.appendChild(<fillColor>{this.fillColor}</fillColor>);
			
			return src;
		}
		
		override public function fromXML(src:XML):void
		{
			this.face = src.@face;
			//this.fillAlpha = src.fillAlpha;
			//this.fillColor = src.fillColor;
		}

	}
}